﻿using System.Collections;
using UnityEngine;

public class Storyboard : MonoBehaviour {

    float[] timeArray = new float[] {4, 6, 8, 10, 12};
    int index;

    public GameObject particle;
    public GameObject bat;
    public GameObject face;
    public GameObject word;

	// Use this for initialization
	void Start () {
        particle.SetActive(false);
        bat.SetActive(false);
        face.SetActive(false);
        word.SetActive(false);
	}
	
	// Update is called once per frame
	void Update () {
        if (index < timeArray.Length && Time.realtimeSinceStartup >= timeArray[index])
        {
            OnTime(index);
            index++;
        }
	}

    void OnTime(int index) {
        switch (index)
        {
            case 0: 
                particle.SetActive(true);
                break;
            case 1:
                bat.SetActive(true);
                break;
            case 2:
                face.SetActive(true);
                break;
            case 3:
                face.GetComponent<AudioSource>().Play();
                break;
            case 4:
                word.SetActive(true);
                break;
        }
    }

}
